/**
 * Created by itrufeng on 5/21/14.
 */
Ext.define('qjtravel.controller.SpotController', {
    extend: 'Ext.app.Controller',
    config: {
        refs: {
            travel: 'travel',
            travelDetail:'travelDetail',
            select_travel: 'travel #select_travel'
        },
        control: {
            select_travel: {
                itemtap: function (data, index, item, record) {
                    Ext.Viewport.mask({xtype: 'loadmask' });
                    var travelDetail = this.getTravelDetail();
                    if(travelDetail== null){
                        travelDetail = Ext.create('qjtravel.view.TravelDetail');
                    }
                    Ext.getCmp("toolbar_travel").setTitle("");
                    Ext.getCmp('toolbar_name').setValue("");
                    Ext.getCmp("contentView").setHtml("")
                    Ext.getCmp("fieldCpid").setValue("");
                    Ext.getCmp('toolbar_travel').setTitle(record.data.name);
                    Ext.getCmp('toolbar_name').setValue(record.data.name);
                    Ext.getCmp("fieldCpid").setValue(record.data.cpid);
                    setTimeout(function(){
                        Ext.Viewport.animateActiveItem(travelDetail,{type: 'slide', direction: 'left'});
                        Ext.Viewport.unmask();
                    },120)
                }
            }
        }
    }
});